# -*- codeing = utf-8 -*-
# @Time : 2023/2/20 17:18
# @Author : 小马
# @File: Bullet.py
# @Software : PyCharm
import pygame.sprite
import pygame


class Bullet(pygame.sprite.Sprite):
    def __init__(self,adrect,bg_size):


        super(Bullet,self).__init__()
        self.image=pygame.image.load('material/zidan.png').convert_alpha()
 #       self.images=[pygame.image.load('material/badman1.{:d}.png'.format(i)).convert_alpha() for i in range(1,6)]
        self.rect = self.image.get_rect()
        #定义子弹的初始化位置
       # self.rect.left=adrect[0]+45
        self.rect.left=adrect.left+50
        self.rect.top=adrect.top+15
        self.width=bg_size[0]
        self.speed=5
    def update(self,*args):

        if self.rect.right>=1200:
            self.kill()
        else:
            self.rect.left += self.speed


